<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/jsp/manage/common/taglibs.jsp" %>
<div class="body" style="position: relative">
    <div style="position: absolute;left: 20px;top:10px ; width: 70px; text-align: center;color: #47a6f5;cursor:pointer;border: 1px solid  #47a6f5;line-height: 28px"
         onclick="manage_sys_opens('中心机房','/manage/demo/powerPage/tosecondaryPages.html')">返回</div>
<div class="container"><div class="EMStop1"></div></div>
<div class="container1">
    <div class="EMSUspContent" style="position: relative">
        <p class="EMStitle" style="position: absolute;top:40px ;position: relative">UPS电量仪实时监控</p>
        <div class="content">
            <div class="left">
                <div class="upsSd"  style=" background-image: url('/manage/assert/image/uspdy.gif');">
                    <div class="loading" id="box">

                    </div>
                </div>
                <p>连接状态 :<span class="linkSuccess"></span></p>
            </div>
            <div style="overflow: hidden;width:69% ">
                <div class="right" style="height: 380px; width:calc(100% + 19px);overflow: auto;font-size: 18px">
<%--            <div class="right" >--%>
                    <table id="upsPowerInput_table"  border="2">
                    <tr>
                        <th class="blueBg">标题</th>
                        <th class="blueBg">A相</th>
                        <th class="blueBg">B相</th>
                        <th class="blueBg">C相</th>
                    </tr>
                    <tr>
                        <th class="blueBg">电压</th>
                        <td><span name="aVoltage"></span></td>
                        <td><span name="bVoltage"></span></td>
                        <td><span name="cVoltage"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">电流</th>
                        <td><span name="aCurrent"></span></td>
                        <td><span name="bCurrent"></span></td>
                        <td><span name="cCurrent"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">有功功率</th>
                        <td><span name="aAvailablePower"></span></td>
                        <td><span name="bAvailablePower"></span></td>
                        <td><span name="cAvailablePower"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">无功功率</th>
                        <td><span name="aUselessPower"></span></td>
                        <td><span name="bUselessPower"></span></td>
                        <td><span name="cUselessPower"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">功率因素</th>
                        <td><span name="aPowerFactor"></span></td>
                        <td><span name="bPowerFactor"></span></td>
                        <td><span name="cPowerFactor"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">AB相电压</th>
                        <td><span name="abVoltage"></span></td>
                        <th class="blueBg">BC相电压</th>
                        <td><span name="bcVoltage"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">CA相电压</th>
                        <td><span name="caVoltage"></span></td>
                        <th class="blueBg">总有功功率</th>
                        <td><span name="totalAvailablePowerMin"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg"> 总无功功率</th>
                        <td><span name="totalUselessPowerMin"></span></td>
                        <th class="blueBg">功率因数总和</th>
                        <td><span name="totalPowerFactor"></span></td>
                    </tr>
                   <%-- <tr>
                        <td class="blueBg">总无功功率 低16位</td>
                        <td><span name="totalUselessPowerMin"></span></td>

                        <td class="blueBg">总无功功率 高16位</td>
                        <td><span name=""></span></td>
                    </tr>--%>
                    <tr>
                        <th class="blueBg">频率</th>
                        <td><span name="rate"></span></td>
                        <th class="blueBg">互感因素</th>
                        <td><span name="">30</span></td>
                    </tr>
                </table>
                 </div>
            </div>
        </div>
    </div>
</div>

</div>
</html>

<script>
    $(function () {
        var count = 0;
        var t = setInterval(function () {
            var $redDiv = $("#box").find(".greenBg");
            if(count === 15){
                count=-1;
                $("#box").find('.greenBg').removeClass('greenBg').addClass('white');
                $redDiv=$("#box").find(".first");
                $("#box").find(".last").removeClass("greenBg").addClass("white");
            }
            $redDiv.next().removeClass("white").addClass("greenBg");
            count++;
        }, 1000);
        $.post("/manage/demo/equipment/fetchLastData.html?eids="+ $.websocket.dly,function (entity) {

            if (entity.equipmentid == $.websocket.dly) {//电量仪
                $("#upsPowerInput_table span[name='aVoltage']").text(entity.aVoltage.toFixed(2));
                $("#upsPowerInput_table span[name='bVoltage']").text(entity.bVoltage.toFixed(2));
                $("#upsPowerInput_table span[name='cVoltage']").text(entity.cVoltage.toFixed(2));
                $("#upsPowerInput_table span[name='aCurrent']").text(entity.aCurrent.toFixed(2));
                $("#upsPowerInput_table span[name='bCurrent']").text(entity.bCurrent.toFixed(2));
                $("#upsPowerInput_table span[name='cCurrent']").text(entity.cCurrent.toFixed(2));
                $("#upsPowerInput_table span[name='totalAvailablePowerMax']").text(entity.totalAvailablePowerMax.toFixed(2));
                $("#upsPowerInput_table span[name='totalUselessPowerMax']").text(entity.totalUselessPowerMax.toFixed(2));
                if(entity.aAvailablePower){
                    $("#upsPowerInput_table span[name='aAvailablePower']").text(entity.aAvailablePower.toFixed(2));
                }

                $("#upsPowerInput_table span[name='bUselessPower']").text(entity.bUselessPower.toFixed(2));
                $("#upsPowerInput_table span[name='cUselessPower']").text(entity.cUselessPower.toFixed(2));
                $("#upsPowerInput_table span[name='aUselessPower']").text(entity.aUselessPower.toFixed(2));
                $("#upsPowerInput_table span[name='bAvailablePower']").text(entity.bAvailablePower.toFixed(2));
                $("#upsPowerInput_table span[name='cAvailablePower']").text(entity.cAvailablePower.toFixed(2));
                $("#upsPowerInput_table span[name='aPowerFactor']").text(entity.aPowerFactor.toFixed(2));
                $("#upsPowerInput_table span[name='bPowerFactor']").text(entity.bPowerFactor.toFixed(2));
                $("#upsPowerInput_table span[name='cPowerFactor']").text(entity.cPowerFactor.toFixed(2));
                $("#upsPowerInput_table span[name='rate']").text(entity.rate.toFixed(2));

                entity.totalAvailablePowerMin=parseFloat(entity.aAvailablePower)+parseFloat(entity.cAvailablePower)+parseFloat(entity.bAvailablePower)
                $("#upsPowerInput_table span[name='totalAvailablePowerMin']").text(entity.totalAvailablePowerMin.toFixed(2));
                entity.totalUselessPowerMin=parseFloat(entity.aUselessPower)+parseFloat(entity.bUselessPower)+parseFloat(entity.cUselessPower)
                $("#upsPowerInput_table span[name='totalUselessPowerMin']").text(entity.totalUselessPowerMin.toFixed(2));
                //entity.totalPowerFactor=parseFloat(entity.aPowerFactor)+parseFloat(entity.bPowerFactor)+parseFloat(entity.cPowerFactor)
                $("#upsPowerInput_table span[name='totalPowerFactor']").text(entity.totalPowerFactor.toFixed(2));
            }
        })
       // }
    });
</script>